#ifndef INFOS_H
#define INFOS_H

#include "tlib/tlib.h"
#include "host.h"

/*
 *	FileInfo
 */
class FileInfo : public TListObj
{
public:
	FileInfo( int id = 0 );
	FileInfo( const FileInfo& org );
	~FileInfo();
	FileInfo& operator= ( const FileInfo& org );

	int GetId(){ return _id; }
	void SetId( int id ){ _id = id; }
	const char* GetFileName(){ return _fileName ? _fileName : _fileNameExt; }
	void SetFileName( const char* fileName ){ if( _fileName ) free( _fileName ); _fileName = (char*)_strdup( fileName ); }
	__int64 GetSize(){ return _size; }
	void SetSize( __int64 size ){ _size = size; }
	time_t GetMtime(){ return _mtime; }
	void SetMtime( time_t mtime ){ _mtime = mtime; }
	time_t GetAtime(){ return _atime; }
	void SetAtime( time_t atime ){ _atime = atime; }
	time_t GetCrtime(){ return _crtime; }
	void SetCrtime( time_t crtime ){ _crtime = crtime; }
	UINT GetAttr(){ return _attr; }
	void SetAttr( UINT attr ){ _attr = attr; }
	bool IsSelected(){ return _selected; }
	void SetSelected( bool selected ){ _selected = selected; }

private:
	int			_id;
	char*		_fileName;
	const char* _fileNameExt;
	UINT		_attr;
	__int64	_size;
	time_t	_mtime;
	time_t	_atime;
	time_t	_crtime;
	bool	_selected;	// for recvDlg;
};

/*
 *	ConnectInfo
 */
struct ConnectInfo : public TListObj
{
	SOCKET	_sock;
	ULONG	_addr;
	int		_port;
	bool	_server;
	bool	_complete;
	DWORD	_startTick;
	DWORD	_lastTick;
};

/*
 *	AcceptFileInfo
 */
struct AcceptFileInfo
{
	FileInfo*	_fileInfo;
	Host*		_host;
	__int64		_offset;
	int			_packetNo;
	UINT		_command;
	FILETIME	_attachTime;
};

#endif	// INFOS_H